import { resources, SpriteFrame } from "cc";
import Singleton from "../Base/Singleton";


export default class ResourcesManager extends Singleton {
    static get Instance() {
        return super.GetInstance<ResourcesManager>();
    }

    loadRes(path: string, type: typeof SpriteFrame = SpriteFrame) {
        return new Promise<SpriteFrame[]>((reslove, reject) => {
            resources.loadDir(path, type, function (err, assets) {
                if (err) {
                    reject(err);
                    return;
                }
                reslove(assets);
            })
        })
    }
}